package com.qst.rongxiaoserver.model;

public enum FinanceStatus {
    PENDING(0, "待审核"),
    APPROVED(1, "已批准"),
    REJECTED(2, "已拒绝");

    private final int code;
    private final String description;

    FinanceStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static FinanceStatus fromCode(int code) {
        for (FinanceStatus status : FinanceStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的状态码: " + code);
    }
}